package com.itdaan.portal.business.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.itdaan.portal.business.domain.WebType;
import com.itdaan.portal.business.mapper.WebTypeMapper;
import com.itdaan.portal.business.service.WebTypeService;
import com.itdaan.portal.common.exception.ServiceException;
/**
 * @author www.itdaan.com
 */
@Service(value = "webTypeService")
public class WebTypeServiceImpl implements WebTypeService {

	@Resource(name = "webTypeMapper")
	private WebTypeMapper webTypeMapper;
	
	@Override
	public List<WebType> findWebTypes(WebType webType) throws ServiceException {
		return webTypeMapper.selectWebTypes(webType);
	}

	@Override
	public int findWebTypeCount(WebType webType) throws ServiceException {
		return webTypeMapper.selectWebTypeCount(webType);
	}

	@Override
	public WebType findWebTypeOne(WebType webType) throws ServiceException {
		return webTypeMapper.selectByPrimaryKey(webType.getId());
	}

	@Override
	public int updateWebType(WebType webType) throws ServiceException {
		return webTypeMapper.updateByPrimaryKeySelective(webType);
	}

	@Override
	public int delWebTypes(String ids) throws ServiceException {
		String [] idss = ids.split(",");
		for(String id : idss){
			webTypeMapper.deleteByPrimaryKey(Integer.parseInt(id));
		}
		return 1;
	}

	@Override
	public int addWebType(WebType webType) throws ServiceException {
		return webTypeMapper.insert(webType);
	}
	
	
	
}
